<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of MY_Exceptions
 *
 * @author lucas_p
 */
class MY_Exceptions extends CI_Exceptions {

    //put your code here
    public function __construct() {
        parent::__construct();
    }

    // --------------------------------------------------------------------

    /**
     * General Error Page
     *
     * This function takes an error message as input
     * (either as a string or an array) and displays
     * it using the specified template.
     *
     * @param	string	the heading
     * @param	string	the message
     * @param	string	the template name
     * @param 	int	the status code
     * @return	string
     */
    public function show_error($heading, $message, $template = 'error_general', $status_code = 500) {
        log_message('error', 'Severity: ' . $status_code . ' - ' . $heading . '  --> ' . implode("\n", $message), TRUE);
        return parent::show_error($heading, $message, $template, $status_code);
    }

    // --------------------------------------------------------------------

    /**
     * Native PHP error handler
     *
     * @param	string	the error severity
     * @param	string	the error string
     * @param	string	the error filepath
     * @param	string	the error line number
     * @return	string
     */
    public function show_php_error($severity, $message, $filepath, $line) {
        log_message('error', 'Severity: ' . $severity . '  --> ' . implode("\n", $message) . ' ' . $filepath . ' ' . $line, TRUE);
        return parent::show_php_error($severity, $message, $filepath, $line);
    }

}
